"""Twitter user page on Gittip. """ import datetime import decimal import requests from aspen import json, Response, log from aspen.utils import to_age, utc from gittip import AMOUNTS, CARDINALS, db from gittip.elsewhere import twitter from gittip.models import Participant # ========================================================================== ^L # Try to load from Twitter. # ========================= user_info = twitter.get_user_info(path['screen_name']) # Try to load from Gittip. # ======================== username = user_info['screen_name'] name = user_info.get('name') if not name: name = username url = user_info['html_url'] = "https://twitter.com/%s" % username account = twitter.TwitterAccount(user_info['id'], user_info) participant = Participant.query.get(account.participant) if account.is_claimed: request.redirect('/%s/' % participant.username) locked = account.is_locked lock_action = "unlock" if account.is_locked else "lock" nbackers = participant.get_number_of_backers() title = username # ========================================================================== ^L {% extends templates/base.html %} {% block heading %}

Twitter

{% end %} {% block box %}

{{ escape(username) }} has

{{ nbackers }}
{{ 'person' if nbackers == 1 else 'people' }} ready to give
{% end %} {% block page %}
{% if account.is_locked %}

{{ escape(username) }} has opted out of Gittip.

If you are {{ escape(username) }} on Twitter, you can unlock your account to allow people to pledge tips to you on Gittip.

{% else %}

{{ escape(name) }} has not joined Gittip.

Is this you? {% if user.ANON %} Click here to opt in to Gittip. We never collect money for you until you do. {% else %} Sign out and sign back in to claim this account {% end %}

{% if user.ANON %}

What is Gittip?

Gittip is a way to thank and support your favorite artists, musicians, writers, programmers, etc. by setting up a small weekly cash gift to them. Read more ...

Don't like what you see?

If you are {{ escape(username) }} you can explicitly opt out of Gittip by locking this account. We don't allow new pledges to locked accounts.

{% end %} {% end %}
{% end %}